package leetcode.weekly.week316;

import java.util.HashMap;
import java.util.Map;

//Solution3Test
public class Solution3 {

	public long minCost(int[] nums, int[] cost) {
		long[] hash = new long[1000001];
		for (int i = 0; i < cost.length; i++) {
			hash[nums[i]] += cost[i];
		}
		long ans = 0;
		int l = 0, r = 1000001;
		while (l <= r) {
			int mid = ((r - l) >> 1) + l;
			long left = 0;
			for (int i = 0; i <= mid; i++) {
				if (nums[i] != 0) {
					left = 1l * (mid - i) * nums[i];
				}
			}
			long right = 0;
			for (int i = mid + 1; i < 1000001; i++) {
				if (nums[i] != 0) {
					right = 1l * (i - mid) * nums[i];
				}
			}
		}

		return ans;
	}

}
